import { Button } from "antd";
import MainLayout from "./layout";
import Login from "./views/login";
import { Route } from "react-router-dom";
import { connect } from "react-redux";
import { Redirect } from "react-router-dom";
function App(props) {
  console.log("App组件的props", props);
  return (
    <div className="App">
      {/* <Button type="primary">按钮</Button> */}
      {/* <MainLayout /> */}
      {/* <Login /> */}
      <Route
        path="/"
        render={() => {
          if (props.user.isLogin) {
            return <MainLayout />;
          } else {
            return <Redirect to="/login" />;
          }
        }}
      />
      <Route path="/login" component={Login} />
    </div>
  );
}

export default connect(({ user }) => ({ user }))(App);
